﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ServBus.ListForm2013.Setup.SubForms;

namespace ServBus.ListForm2013.Setup
{
    public partial class SetupForm : Form
    {
        private BaseStepForm currentStep;
        public BaseStepForm CurrentStep
        {
            get
            {
                return currentStep;
            }
            set
            {
                currentStep = value;
                this.labelTitle.Text = value.Title;
                this.labelSubTitle.Text = value.SubTitle;
                value.Dock = DockStyle.Fill;
                this.panelMain.Controls.Clear();
                this.panelMain.Controls.Add(value);
            }
        }

        public Button PrevButton
        {
            get { return this.btnPrevious; }
        }

        public Button NextButton
        {
            get { return this.btnNext; }
        }

        public Button AbortButton
        {
            get { return this.btnAbort; }
        }

        public SetupForm()
        {
            InitializeComponent();
        }

        private void SetupForm_Load(object sender, EventArgs e)
        {
            this.Text = Properties.Resources.SetupFormTitle;
            this.btnAbort.Text = Properties.Resources.AbortButton;
            this.btnPrevious.Text = Properties.Resources.PrevButton;
            this.btnNext.Text = Properties.Resources.NextButton;

            // First Step: Welcome
            this.CurrentStep = new WelcomeForm(null, this);
            this.CurrentStep.Init();
        }

        private void linkLabelServBus_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("http://www.servbus.com");
        }

        private void btnAbort_Click(object sender, EventArgs e)
        {
            this.CurrentStep.AbortSteup();
        }

        private void btnPrevious_Click(object sender, EventArgs e)
        {
            this.CurrentStep = this.CurrentStep.PreviousStep;
        }

        internal void btnNext_Click(object sender, EventArgs e)
        {
            this.CurrentStep = this.CurrentStep.NextStep;
        }
    }
}
